package pck_utilitarios;

import java.sql.Connection;
import java.sql.DriverManager;

/**
 * @author Miguel Angel Timana paz
 * mamama
 */
public class Cls_Conexion {

    public static String usuario = "sa" ;
    public static String contrasena = "administrador1234";//EPS GRAU
//    public static String contrasena = "";//Local
    public static String url = "jdbc:sqlserver://192.168.23.40;instanceName=sql20051;databaseName=recursoshumanos";//EPS GRAU
//    public static String url= "jdbc:jtds:sqlserver://192.168.56.101/RecursosHumanos";//Local
//    public static String url= "jdbc:jtds:sqlserver://localhost/RecursosHumanos";//Local

    public Connection cn;
    public static void registrarDriver(){
        try{
            //Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstance();//EPS GRAU
            Class.forName("net.sourceforge.jtds.jdbc.Driver").newInstance();// Local
        }catch(Exception e){
            System.out.println(e.getMessage());
        }         
    }
    public static Connection obtenerConexion(){        
        try{            
            return DriverManager.getConnection(url,usuario,contrasena);
        }catch(Exception s){
            System.out.println(s.getMessage());
            return null;
        }        
    }
}